package WaiBao;

import java.util.Arrays;

public class WuJiaXin {
    public static void main(String[] args) {
        String[] name = {"瓶子(宣传委员)", "壮壮(体育委员)", "小哈(文艺委员)", "瘦子(组织委员)", "张三", "四四", "王蛤", "浩六", "飞飞", "白居易", "白警惕", "大话",
                "算算", "花瓶", "查查", "哒哒", "球球", "小明", "小红", "上官", "葫芦", "闫水", "欧哦", "鲍道", "祝接", "篮拦", "小节", "猫猫",
                "欧豪辰", "武佳欣 (学生)"};//考生本人：武佳欣 (学生)
        int[] age = {19, 20, 18, 18, 19, 20, 19, 21, 19, 18, 18, 19, 19, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 19, 19, 19};
        double[] shengwu = {87, 85, 86, 95, 68, 69, 78, 89, 80, 90, 90, 87, 85, 75, 65, 68, 69, 69, 96, 98, 92, 91, 95, 85, 75, 74, 74, 74, 82, 88};
        double[] weisheng = {79, 87, 62, 68, 68, 67, 88, 79, 90, 90, 90, 77, 86, 75, 65, 65, 66, 79, 96, 98, 92, 71, 95, 85, 75, 84, 74, 64, 92, 94};
        double[]  renti = {69, 98, 86, 95, 77, 69, 78, 89, 80, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 76, 84, 73, 71, 82, 93};

        double ret;//代表每个学生的总分
        double Ag;//代表每个学生的平均分
//     for (int i = 0; i < 30; i++) {
//            ret = shengwu[i]+weisheng[i]+renti[i];
//            Ag = (ret*1.0)/3;
//            System.out.println(name[i]+"的总分为:"+ret);
//            System.out.println(name[i]+"的平均分为:"+Ag);
//        }


        double Sum1=0,avg = 0;
        double [] arr = new double[30];
//        for (int i = 0; i < 30; i++) {
//            Sum1 = shengwu[i]+weisheng[i]+renti[i];
//            avg = (Sum1*1.0)/3;
//            arr[i] = avg;
//        }
//
//        for (int i = 0; i < arr.length-1; i++) {
//            for (int j = 0; j < arr.length-i-1; j++) {
//                if(arr[j] < arr[j+1]){
//                    double tep = arr[j];
//                    arr[j] =arr[j+1];
//                    arr[j+1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(arr[i]);
//        }



        double q1 = 0, q2 = 0, q3 = 0;//计算每门课的平均分
        double t1 = 0, t2 = 0, t3 = 0;//计算每门课标准差
        double x1 = 0, x2 = 0, x3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < shengwu.length; i++) {
            sum2+=shengwu[i];
        }
        q1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+q1);
        double Sum = 0;
        for (int i = 0; i < weisheng.length; i++) {
            Sum+=weisheng[i];
        }
        q2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+q2);
        double sum = 0;
        for (int i = 0; i < renti.length; i++) {
            sum+=renti[i];
        }
        q3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+q3);

        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < shengwu.length; i++) {
            c1+= (shengwu[i] - q1)*(shengwu[i] - q1);
        }
        t1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+t1);

        for (int i = 0; i < weisheng.length; i++) {
            c2+= (weisheng[i] - q2)*(weisheng[i] - q2);
        }
        t2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+t2);

        for (int i = 0; i < renti.length; i++) {
            c3+= (renti[i] - q3)*(renti[i] - q3);
        }
        t3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+t3);

//        Arrays.sort(shengwu);
//        Arrays.sort(weisheng);
//        Arrays.sort(renti);
//        x1 =( shengwu[15]+shengwu[16])*1.0/2;
//        x2 =( weisheng[15]+weisheng[16])*1.0/2;
//        x3 =( renti[15]+renti[16])*1.0/2;
//        System.out.println("生物化学的中位数为:"+x1);
//        System.out.println("微生物学的中位数为:"+x2);
//        System.out.println("人体组织解剖学的中位数为:"+x3);
    }
}
